import * as vscode from "vscode";

let channel = vscode.window.createOutputChannel("VEMACS");

function mapToString(obj?: any) {
  switch (typeof obj) {
    case "undefined":
      return "undefined";
    case "string":
      return obj;
    case "number":
      return obj.toString();
    case "object":
      return "" + obj;
    default:
      return "" + obj;
  }
}

export let logger = {
  info: (message?: any, ...o: any[]): void => {
    channel.append("[INFO]");
    channel.append(mapToString(message));
    o.map((args: any) => {
      channel.append(", " + mapToString(args));
    });
    channel.appendLine("");
    channel.show(true);
  },
};
